{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c92eef83",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 本周内容\n",
    "> 1.while循环的回顾：while Ture 无限循环\n",
    ">> 可以指定次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "999a2243",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 本周内容\n",
    "> 1. 元组\n",
    "> 2. 集合\n",
    "> 3. 字典"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b5984b08",
   "metadata": {},
   "source": [
    "# 1. 元组（tuples）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3677ba0c",
   "metadata": {},
   "source": [
    "> 1,元组的基本内容（形态，定义）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f7474a08",
   "metadata": {},
   "source": [
    "> 2.元组的性质\n",
    ">> 1. 有序性(indexing有顺序，slicing可切片的)\n",
    ">> 2. 不可变性：不同之处在于元组的元素不能修改。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1a1f3606",
   "metadata": {},
   "outputs": [],
   "source": [
    "> 3. 元组的一般方式"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a00dce55",
   "metadata": {},
   "source": [
    "### 强调与列表的区别，列表用方括号。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ee59d734",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1800001, 1800002, 1800003) <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "网一_学号 = (1800001,1800002,1800003)\n",
    "print(网一_学号,type(网一_学号))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "8a80b0c5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1800001, 1800002, 1800003) <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "网一_学号 = 1800001,1800002,1800003\n",
    "print(网一_学号,type(网一_学号))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "37632eab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1800001"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网一_学号[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b9a38d5a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1800002, 1800003)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网一_学号[1:]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "37b53798",
   "metadata": {},
   "source": [
    "#### 一般情况下，元组里面存放常量：数字，字符串。不存放变量：列表（列表是可增，删，改的），字典"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1d7a74bd",
   "metadata": {},
   "source": [
    "# 集合(sets)：集合可以去重\n",
    "> 1. 基本概念\n",
    ">> 1. 性质：没有重复项\n",
    ">> 2. 性质：无序性\n",
    "> 2. 集合的一般方法\n",
    "> 3. 集合的运算：&，|"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f00ae48c",
   "metadata": {},
   "source": [
    "> 集合的与运算，交集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9ad0161e",
   "metadata": {},
   "outputs": [],
   "source": [
    "舞蹈社 & 电竞社"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ec16c917",
   "metadata": {},
   "source": [
    "> 集合的或运算，并集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2123347e",
   "metadata": {},
   "outputs": [],
   "source": [
    "舞蹈社 | 电竞社"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "07fe2244",
   "metadata": {},
   "outputs": [],
   "source": [
    "len(舞蹈社 | 电竞社)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bc2daef0",
   "metadata": {},
   "outputs": [],
   "source": [
    "舞蹈社.union(电竞社)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0e21dc70",
   "metadata": {},
   "source": [
    "# 字典(ditionary)很重要"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3bc8d56a",
   "metadata": {},
   "source": [
    "> 1. 字典性质：\n",
    ">> 1. 无序性\n",
    ">> 2. keys 是不可变的\n",
    ">> 3. keys 是唯一的\n",
    "> 2. 字典的形态\n",
    "> 3. 字典的一般方法\n",
    ">> 1. 字典的创建\n",
    ">> 2. 字典的函数和方法\n",
    ">>> 1. 增加\n",
    ">>> 2. 删除\n",
    ">>> 3. 修改"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c6b738d9",
   "metadata": {},
   "source": [
    "### 字典的取值：通过keys进行字典的取值，不像列表、元组和字符串通过index取值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d7374d25",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 字典的性质和概念"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8f1ea9c7",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新1班_学号 = "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9c2148cf",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f5fa903a",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ed340560",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 字典的一般方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a94c1db8",
   "metadata": {},
   "outputs": [],
   "source": [
    "- 1.按照字典的形式直接创建（key：value）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "71591446",
   "metadata": {},
   "outputs": [],
   "source": [
    "- 2.使用dict（）方法创建字典"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "d0730b24",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (3632046032.py, line 3)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Input \u001b[1;32mIn [11]\u001b[1;36m\u001b[0m\n\u001b[1;33m    stu18002=\"jenny\",\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "网新1班 = dict(\n",
    "     stu18001=\"温欣欣\"\n",
    "     stu18002=\"jenny\",\n",
    "     stu18003=\"haha\",\n",
    "     stu18004=\"jack\",\n",
    "     stu18005=\"nancy\",\n",
    "    )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "b9c07fd6",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '网新1班' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [9]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43m网新1班\u001b[49m\n",
      "\u001b[1;31mNameError\u001b[0m: name '网新1班' is not defined"
     ]
    }
   ],
   "source": [
    "网新1班"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c8329def",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bb434223",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "257de576",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "cde45289",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '舞蹈社' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [6]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43m舞蹈社\u001b[49m\u001b[38;5;241m.\u001b[39munion(电竞社)\n",
      "\u001b[1;31mNameError\u001b[0m: name '舞蹈社' is not defined"
     ]
    }
   ],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
